package com.briup.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionTest {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        // 定义数据库的基本信息
        String url = "jdbc:mysql://192.168.179.11:3306/briup";
        String user = "root";
        String password = "root";
        String driver = "com.mysql.cj.jdbc.Driver";
        // 使用反射的方式加载驱动
        Class.forName(driver);
        // 获取和mysql的连接
        Connection connection = DriverManager.getConnection(url, user, password);
        System.out.println(connection);
    }
}
